package cn.mldn.mldncloud.service.fallback;		// 该程序包需要配置扫描

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;

import cn.mldn.mldncloud.dto.OrdersDTO;
import cn.mldn.mldncloud.service.ICOrdersService;
import feign.hystrix.FallbackFactory;

@Component
public class OrdersServiceFallbackFactory implements FallbackFactory<ICOrdersService> {

	@Override
	public ICOrdersService create(Throwable exp) {
		return new ICOrdersService() {
			@Override
			public List<OrdersDTO> listOrders(String refectoryId)  {
				List<OrdersDTO> list = new ArrayList<OrdersDTO>();
				OrdersDTO dto = new OrdersDTO();
				dto.setOname("陈超");
				System.err.println("进行了fallback调用");
				System.err.println("进行了fallback调用");
				System.err.println("进行了fallback调用");
				System.err.println("进行了fallback调用");
				System.err.println("进行了fallback调用");
				list.add(dto);
				return list; 
			}

			@Override
			public List<OrdersDTO> listTodayOrders(String refectoryId) {
				List<OrdersDTO> list = new ArrayList<OrdersDTO>();
				OrdersDTO dto = new OrdersDTO();
				dto.setOname("陈超");
				System.err.println("进行了fallback调用");
				System.err.println("进行了fallback调用");
				System.err.println("进行了fallback调用");
				System.err.println("进行了fallback调用");
				System.err.println("进行了fallback调用");
				list.add(dto);
				return list; 
			}

			
			@Override
			public Map<String, Object> listTodayOrdersPage(String refectoryId, int page, int size) {
				// TODO Auto-generated method stub
				return null;
			}

			@Override
			public Map<String, Object> listOrdersPage(String refectoryId, int page, int size) {
				// TODO Auto-generated method stub
				return null;
			}
		};
	}

}
